package fit.conceptmap.entities;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the user database table.
 * 
 */
@Entity
@NamedQuery(name="User.findAll", query="SELECT u FROM User u")
public class User implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String idUser;

	@Temporal(TemporalType.DATE)
	private Date dateBirth;

	@Lob
	private String fullName;

	@Lob
	private byte[] image;

	private byte mile;

	private String password;

	//bi-directional many-to-one association to Assignment
	@OneToMany(mappedBy="user")
	private List<Assignment> assignments;

	//bi-directional many-to-one association to Conceptmap
	@OneToMany(mappedBy="user")
	private List<Conceptmap> conceptmaps;

	//bi-directional many-to-one association to MemberAssignment
	@OneToMany(mappedBy="user")
	private List<MemberAssignment> memberAssignments;

	//bi-directional many-to-one association to Message
	@OneToMany(mappedBy="user")
	private List<Message> messages;

	//bi-directional many-to-one association to Node
	@OneToMany(mappedBy="user")
	private List<Node> nodes;

	//bi-directional many-to-one association to Share
	@OneToMany(mappedBy="user")
	private List<Share> shares;

	//bi-directional many-to-one association to Role
	@ManyToOne
	@JoinColumn(name="role")
	private Role roleBean;

	public User() {
	}

	public String getIdUser() {
		return this.idUser;
	}

	public void setIdUser(String idUser) {
		this.idUser = idUser;
	}

	public Date getDateBirth() {
		return this.dateBirth;
	}

	public void setDateBirth(Date dateBirth) {
		this.dateBirth = dateBirth;
	}

	public String getFullName() {
		return this.fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public byte[] getImage() {
		return this.image;
	}

	public void setImage(byte[] image) {
		this.image = image;
	}

	public byte getMile() {
		return this.mile;
	}

	public void setMile(byte mile) {
		this.mile = mile;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public List<Assignment> getAssignments() {
		return this.assignments;
	}

	public void setAssignments(List<Assignment> assignments) {
		this.assignments = assignments;
	}

	public Assignment addAssignment(Assignment assignment) {
		getAssignments().add(assignment);
		assignment.setUser(this);

		return assignment;
	}

	public Assignment removeAssignment(Assignment assignment) {
		getAssignments().remove(assignment);
		assignment.setUser(null);

		return assignment;
	}

	public List<Conceptmap> getConceptmaps() {
		return this.conceptmaps;
	}

	public void setConceptmaps(List<Conceptmap> conceptmaps) {
		this.conceptmaps = conceptmaps;
	}

	public Conceptmap addConceptmap(Conceptmap conceptmap) {
		getConceptmaps().add(conceptmap);
		conceptmap.setUser(this);

		return conceptmap;
	}

	public Conceptmap removeConceptmap(Conceptmap conceptmap) {
		getConceptmaps().remove(conceptmap);
		conceptmap.setUser(null);

		return conceptmap;
	}

	public List<MemberAssignment> getMemberAssignments() {
		return this.memberAssignments;
	}

	public void setMemberAssignments(List<MemberAssignment> memberAssignments) {
		this.memberAssignments = memberAssignments;
	}

	public MemberAssignment addMemberAssignment(MemberAssignment memberAssignment) {
		getMemberAssignments().add(memberAssignment);
		memberAssignment.setUser(this);

		return memberAssignment;
	}

	public MemberAssignment removeMemberAssignment(MemberAssignment memberAssignment) {
		getMemberAssignments().remove(memberAssignment);
		memberAssignment.setUser(null);

		return memberAssignment;
	}

	public List<Message> getMessages() {
		return this.messages;
	}

	public void setMessages(List<Message> messages) {
		this.messages = messages;
	}

	public Message addMessage(Message message) {
		getMessages().add(message);
		message.setUser(this);

		return message;
	}

	public Message removeMessage(Message message) {
		getMessages().remove(message);
		message.setUser(null);

		return message;
	}

	public List<Node> getNodes() {
		return this.nodes;
	}

	public void setNodes(List<Node> nodes) {
		this.nodes = nodes;
	}

	public Node addNode(Node node) {
		getNodes().add(node);
		node.setUser(this);

		return node;
	}

	public Node removeNode(Node node) {
		getNodes().remove(node);
		node.setUser(null);

		return node;
	}

	public List<Share> getShares() {
		return this.shares;
	}

	public void setShares(List<Share> shares) {
		this.shares = shares;
	}

	public Share addShare(Share share) {
		getShares().add(share);
		share.setUser(this);

		return share;
	}

	public Share removeShare(Share share) {
		getShares().remove(share);
		share.setUser(null);

		return share;
	}

	public Role getRoleBean() {
		return this.roleBean;
	}

	public void setRoleBean(Role roleBean) {
		this.roleBean = roleBean;
	}

}